package com.lagou.controller;


import com.lagou.domain.Dept;
import com.lagou.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;

@Controller
@RequestMapping("/dept")
@SessionAttributes("dept")
public class DeptController {

    @Autowired
    private DeptService deptService;
    /*
        根据id查询账户信息，完成账户回显
     */
    @RequestMapping("/findById")

    public String findById(Integer id, Model model){
        System.out.println("传递过来的部门id为："+id);
        Dept dept = deptService.findById(id);
        System.out.println(dept);
        model.addAttribute("dept",dept);
//        model.addAttribute("account",account);

        return "dept";

//        //存到model中
//        model.addAttribute("dept",dept);
//
//        //视图跳转
////        return  "update";
//
//        return null;
    }


}
